package Multithreading.base;

public class ThreadDemo2 {
    public static void main(String[] args) {
        //开启线程
        //创建线程执行目标
        MyRunnable mr = new MyRunnable();
        Thread thread1 = new Thread(mr);
        thread1.setName("rose");
        Thread thread2 = new Thread(mr);
        thread2.setName("jack");

        //开启线程动作
        thread1.start();
        thread2.start();

        //返回main线程
       Thread mainThread = Thread.currentThread();

        for(int i = 0; i < 50; i++){
            System.out.println(mainThread.getName() + " " +i);
        }

    }
}
